package com.neo.common.base;

import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

@Getter
@Setter
public class BaseCode {

//     private  int status;
//
//     private  Object data;
//
//     private String  message;
//
//    private  long  timestamp=System.currentTimeMillis();
//
//

    public static Map<String, Object> jsonString(String message, Object data, int status) {
        Map<String, Object> returnMap = new LinkedHashMap();
        returnMap.put("status", status);
        returnMap.put("data", data == null ? new HashMap<String,Object>() : data);
        returnMap.put("message", message);
        returnMap.put("timestamp", System.currentTimeMillis());
        return returnMap;
    }

    public static Map<String, Object> jsonString(String message, Object data, int status, String[] excludes) {
        Map<String, Object> returnMap = new LinkedHashMap();
        returnMap.put("status", status);
        returnMap.put("data", data);
        returnMap.put("message", message);
        returnMap.put("timestamp", System.currentTimeMillis());
        return returnMap;
    }

    public static Map<String, Object> jsonString(String message, int status) {
        Map<String, Object> returnMap = new LinkedHashMap();
        returnMap.put("status", status);
        returnMap.put("message", message);
        returnMap.put("data", new HashMap<String,Object>());
        returnMap.put("timestamp", System.currentTimeMillis());
        return returnMap;
    }

    public static Map<String, Object> jsonStringError(String message, int status) {
        Map<String, Object> returnMap = new LinkedHashMap();
        returnMap.put("status", status);
        returnMap.put("message", message);
        returnMap.put("timestamp", System.currentTimeMillis());
        return returnMap;
    }


}
